<?php 
session_start();
include("../JO_02_function.php");
include("../JO_01_configuration.php");
$JO_MySQL = new mysqli( $JO_DB_host, $JO_DB_user, $JO_DB_password, $JO_DB_database );
$JO_MySQL -> query( "SET NAMES 'UTF8'" );
$key=isset($_GET['SO_chude'])?$_GET['SO_chude']:"";
if($key!=''){
$sql='SELECT	account.identifier AS `name` ,account.`key` AS `account_name`,point.*
      FROM	account RIGHT OUTER JOIN point ON account.`key` = point.account 
      where `point`.`delete` is null and `point`.`key`='.$key;
$result=JO_query($sql);
if($result->num_rows)
$row=$result->fetch_array();

        
   ?>
<form method="post" action="JO_05_execution.php" target="JO_integration_asynchronous" enctype="multipart/form-data" onsubmit="return kiemtra()">
<table>
  <input type="hidden"						name="JO_query"				value="point"/>
  <input type="hidden" name="id" value="<?=isset($row['key'])?$row['key']:""?>"   />
  <input type="hidden" name="log" value="<?=isset($row['log'])?$row['log']:""?>"   />
 

  
   <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">Account</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" readonly="readonly" name="account" id="" style="color:black;width:480px"  value="<?=isset($row['name'])?$row['name']:""?>"   style="width:480px !important"/>
          <input type="hidden" name="account" value="<?=isset($row['account_name'])?$row['account_name']:""?>"/>
        </div></td>
    </tr>
  <?php
  $query='Select * 
        from   organization 
        Where  `key`="'.$_SESSION['JO_account_organ'].'"';
  
 $rs=JO_query($query);   
 if($rs->num_rows)
 $rows=$rs->fetch_array();
  $a='Internet Media Team';
  $b=isset($rows['name'])?$rows['name']:"";
  $c=strcmp($a,$b);
  
	 if($c==0){ ?>
     <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">point</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text"  name="point" style="color:black;width:480px"  value="<?=isset($row['point'])?$row['point']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>

  <?php }if($c!=0||$b==''){ ?>
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">point</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" readonly="readonly" name="organization" style="color:black;width:480px"  value="<?=isset($row['point'])?$row['point']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
  
  <?php
	}
?>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Type</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
      <select name="Type" id="Type">
      <option value="" <?=isset($row['type'])?($row['type']==''?"selected='selected'":" "):""?> >---chọn type---</option>
      <option <?=isset($row['type'])?($row['type']=='download'?"selected='selected'":" "):""?>>download</option>
      </select>
        </div></td>
    </tr>
  <tbody id="extendcontent" style="display:none;">
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">free</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="free" name="free" value="<?=isset($row['free'])?$row['free']:""?>"   style="width:480px !important;z-index:999"/>
        </div></td>
  </tr>
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">subject</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="subject"  value="<?=isset($row['subject'])?$row['subject']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">content</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="content"  value="<?=isset($row['content'])?$row['content']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">foreign</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="foreign"  value="<?=isset($row['foreign'])?$row['foreign']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">start</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="start"  value="<?=isset($row['start'])?$row['start']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">end</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="end"  value="<?=isset($row['end'])?$row['end']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
   <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Note</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="note" id="Note" value="<?=isset($row['note'])?$row['note']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Update</div></th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <label><?=isset($row['update'])?$row['update']:""?></label>
        </div></td>
    </tr>
  </tbody>
  <tr class="trextend">
    <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">
        <input  type="button" value="Extend"  id="tab" class="JO_button"   onclick="show();"/>
      </div>
  </th>
    <td width="246px"><input type="submit" value="Submit"  id="submit" class="JO_button"   style="width:240px !important" /></td>
    <td style="padding-left:0 !important"><input type="button" value="Cancel"  id="cancel" class="JO_button"   style="width:240px !important" onClick="move();"/></td>
  </tr>
</table>
</form>
<?php   }if($key==''){?>
<form method="post" action="JO_05_execution.php" target="JO_integration_asynchronous" onsubmit="return kiemtra()" enctype="multipart/form-data"
>
  <table>
    <input type="hidden"						name="JO_query"				value="point_add"/>
    <input type="hidden" name="id" value="<?=isset($row['key'])?$row['key']:""?>"   />
    <input type="hidden" name="log" value="<?=isset($row['log'])?$row['log']:""?>"   />
     <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">account</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="account" id="account_a"  value="<?=isset($row['name'])?$row['name']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
  <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Type</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
      <select name="Type" id="Type">
      <option value="" <?=isset($row['type'])?($row['type']==''?"selected='selected'":" "):""?> >---ch?n type---</option>
      <option <?=isset($row['type'])?($row['type']=='Contract'?"selected='selected'":" "):""?>>download</option>
      </select>
        </div></td>
    </tr>
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">point</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="point"  value="<?=isset($row['point'])?$row['point']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
  
  <tbody id="extendcontent" style="display:none;">
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">free</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="free" name="free" value="<?=isset($row['free'])?$row['free']:""?>"   style="width:480px !important;z-index:999"/>
        </div></td>
  </tr>
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">subject</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="subject"  value="<?=isset($row['subject'])?$row['subject']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">content</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="content"  value="<?=isset($row['content'])?$row['content']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">foreign</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="foreign"  value="<?=isset($row['foreign'])?$row['foreign']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">start</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="start"  value="<?=isset($row['start'])?$row['start']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">end</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="end"  value="<?=isset($row['end'])?$row['end']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
   <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Note</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="note" id="Note" value="<?=isset($row['note'])?$row['note']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Update</div></th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <label><?=isset($row['update'])?$row['update']:""?></label>
        </div></td>
    </tr>
  </tbody>
  <tr class="trextend">
    <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">
        <input  type="button" value="Extend"  id="tab" class="JO_button"   onclick="show();"/>
      </div>
  </th>
    <td width="246px"><input type="submit" value="Submit"  id="submit" class="JO_button"   style="width:240px !important" /></td>
    <td style="padding-left:0 !important"><input type="button" value="Cancel"  id="cancel" class="JO_button"   style="width:240px !important" onClick="move2();"/></td>
  </tr>
  </table>
</form>
<?php    }?>